package com.zby.controller.article;

import com.zby.common.utils.ResultUtil;
import com.zby.model.pojo.ContentBlocks;
import com.zby.service.ContentBlocksService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/article")
@Tag(name = "内容管理")
public class ContentBlocksController {
    @Autowired
    public ContentBlocksService contentBlocksService;

    @PostMapping("/insertContent")
    @Operation(summary = "增加内容块")
    public ResultUtil<Integer> addContentBlocks(@RequestBody ContentBlocks contentBlocks) {
        int contentBlocksId = contentBlocksService.insertContentBlocks(contentBlocks);
        if (contentBlocksId > 0) {
            return ResultUtil.success();
        }
        return ResultUtil.fail();
    }
}
